<?php

namespace EM\NewsBundle\Controller;
use EM\NewsBundle\Entity\Users;
use EM\NewsBundle\Entity\Roles;
use EM\NewsBundle\Entity\Countries;
use EM\NewsBundle\Entity\Languages;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class NewController extends Controller
{
   
   public function createAction(Request $request){
	return $this->render('EMNewsBundle:New:new.html.twig');
   }
	public function saveAction(Request $request)
    {
	 
			return $this->redirect($this->generateUrl('em_news_list',array('status'=>'All')));

	
    }
	public function showAction($status){
	
		$repository=$this->getDoctrine()->getRepository('EMNewsBundle:News');
		if($status=='All')
		{
			$news = $repository->findAll();	
		}
		else
		{
			$news = $repository->findBy(array('status'  => $status ));
		}
		return $this->render('EMNewsBundle:New:list.html.twig',array('news' => $news));
	
	}
	
}
